<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<jsp:include page="../../common/header.jsp" />
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/media/css/datetimepicker.css" />

	<script type="text/javascript" src="<%=request.getContextPath()%>/media/js/bootstrap-datetimepicker.js"></script>
<script src="<%=request.getContextPath()%>/media/js/form-components.js"></script> 
<script>
jQuery(document).ready(function() {    
	FormComponents.init();
});

function back(){
	$("#menu_form").attr("action","<%=request.getContextPath()%>/qrtz/job/list");
		$("#menu_form").submit();
	}
	
function add_param_div(){
	var div = $("[class='control-group']:last");
	
	var str = "<div id=\"control-group\" class=\"control-group\">";
	str+="<label class=\"control-label\"></label>";
	str+="<div class=\"controls\">";
	str+="<input type=\"text\" style=\"width:80px;\" placeholder=\"参数名\" maxlength=\"20\" name=\"params_name\" class=\"m-wrap\" />";
	str+="&nbsp;<input type=\"text\" style=\"width:80px;\" placeholder=\"参数值\" maxlength=\"20\" name=\"params_value\" class=\"m-wrap\" /> ";
	str+="<a href=\"#\" class=\"btn icn-only\" onclick=\"removeParam(this)\"><i class=\"icon-remove\"></i></a>";
	str+="</div></div>";
	div.after(str);
}

function removeParam(btn){
	$(btn).parent().parent().remove();
}
</script>

</head>
<body class="page-header-fixed page-full-width">





		<!-- content -->
		<div class="page-content">


			<!-- BEGIN PAGE CONTAINER-->

			<div class="container-fluid">

				<!-- BEGIN PAGE HEADER-->

				<div class="row-fluid">

					<div class="span12">


						<h3 class="page-title">

							<small></small>

						</h3>

						<ul class="breadcrumb">

							<li><i class="icon-home"></i> <a href="index.html">Home</a>

								<i class="icon-angle-right"></i></li>

							<li><a href="#">系统管理</a> <i class="icon-angle-right"></i></li>

							<li><a href="#">定时任务</a></li>

						</ul>



					</div>

				</div>

				<!-- END PAGE HEADER-->

				<div class="portlet-body form">
					<c:if test="${success}">
						<div class="alert alert-success">
							<button class="close" data-dismiss="alert"></button>
							<spring:message code="save success"></spring:message>
						</div>
					</c:if>
					<c:if test="${success==false}">
						<div class="alert alert-error">
							<button class="close" data-dismiss="alert"></button>
							${error_info}
						</div>
					</c:if>
					<h3 class="page-title">
						<c:if test="${job.jobName==null}">
							新增任务
						</c:if>
						<c:if test="${job.jobName!=null}">
							编辑任务
						</c:if>
					</h3>
					<form id="menu_form"
						action="<c:if test="${job.jobName==null}">add</c:if><c:if test="${job.jobName!=null}">update</c:if>"
						method="post" class="form-horizontal">
						
						<input type="hidden" name="sorting_column_order"
							id="sorting_column_order" value="${sorting_column_order }" /> <input
							type="hidden" name="sorting_asc_desc" id="sorting_asc_desc"
							value="${sorting_asc_desc}" />  <input
							type="hidden" name="token" value="${token}"></input>

					<div class="row-fluid">	
					<div class="span6 ">
						<div class="control-group">
							<label class="control-label">任务名称：</label>
							<div class="controls">
								<input type="text"  style="width: 260px" name="jobName"
									value="${job.jobName }" required class="m-wrap" /> <span
									class="help-inline"></span>
							</div>
						</div>
					</div>


					<div class="span6 ">
						<div class="control-group">
							<label class="control-label">任务分组：</label>

							<div class="controls">

								<input type="text"  style="width: 260px" name="jobGroup"
									value="${job.jobGroup }" required class="m-wrap" /> <span
									class="help-inline"></span>

							</div>

						</div>
					</div>
					</div>
						
						
						
						<div class="row-fluid">
						<div class="span6 ">
						<div class="control-group">

							<label class="control-label">任务类：</label>

							<div class="controls">

								<input type="text"  style="width: 260px" name="jobClassName"
									value="${job.jobClassName}" required class="m-wrap" /> <span
									class="help-inline"></span>

							</div>

						</div>
						</div>
						
						<div class="span6 ">
							<div class="control-group">
								<label class="control-label">任务描述：</label>
								<div class="controls">
	
									<input type="text"  style="width: 260px" name="description"
										value="${job.description}" required class="m-wrap" /> <span
										class="help-inline"></span>
								</div>
							</div>
							</div>
						
						
						</div>
						
						
					
						
						<div class="row-fluid">
						<div class="span6 ">
						<div class="control-group">
							<label class="control-label">开始时间：</label>
							<div class="controls">
							 
								<div class="input-append date form_datetime">
												<input size="16" required name="startTime" type="text" value="" readonly class="m-wrap">
												<span class="add-on"><i class="icon-remove"></i></span>
												<span class="add-on"><i class="icon-calendar"></i></span>
								 </div>
							</div>
						</div>
						</div>
						
						
						<div class="span6 ">
						<div class="control-group">
							<label class="control-label">结束时间：</label>

							<div class="controls">

								<div class="input-append date form_datetime">

												<input size="16" name="endTime" type="text" value="" readonly class="m-wrap">

												<span class="add-on"><i class="icon-remove"></i></span>

												<span class="add-on"><i class="icon-calendar"></i></span>

								 </div>
							</div>

						</div>
						</div>
					</div>

					
					<div class="row-fluid">
					<div class="span6 ">
						<div class="control-group">

							<label class="control-label">表达式：</label>

							<div class="controls">

								<input type="text" style="width: 260px" name="cronExpression"
									value="${job.cronExpression}" required class="m-wrap" /> <span
									class="help-inline"></span>

							</div>
						</div>
					</div>
					</div>
					
					<div class="control-group">
							<label class="control-label">任务参数：</label>
							<div class="controls">
								<input type="text" style="width:80px;" placeholder="参数名" maxlength="20" name="params_name"
									value="" class="m-wrap" /> 
								<input type="text" style="width:80px;" placeholder="参数值" maxlength="20" name="params_value"
									value="" class="m-wrap" /> 
								<a href="#" class="btn icn-only" onclick="add_param_div();"><i class="icon-plus"></i></a>
							</div>
					</div>


						<div class="form-actions">

							<button type="submit" class="btn blue">
								<spring:message code="btn.common.save"></spring:message>
							</button>

							<button type="button" onclick="back();" class="btn">
								<spring:message code="btn.common.back"></spring:message>
							</button>

						</div>



					</form>


				</div>




			</div>


		</div>
		<!-- content end -->






</body>